package com.zbkj.admin.controller;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zbkj.common.annotation.LogControllerAnnotation;
import com.zbkj.common.enums.MethodType;
import com.zbkj.common.model.doctor.Doctor;
import com.zbkj.common.model.order.StoreOrder;
import com.zbkj.common.model.order.StoreOrderInfo;
import com.zbkj.common.model.product.StoreProductAttrValue;
import com.zbkj.common.model.user.User;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.*;
import com.zbkj.common.response.*;
import com.zbkj.common.result.CommonResult;
import com.zbkj.common.utils.AjaxResult;
import com.zbkj.common.utils.CrmebUtil;
import com.zbkj.common.vo.ExpressSheetVo;
import com.zbkj.common.vo.LogisticsResultVo;
import com.zbkj.common.vo.OrderInfoDetailVo;
import com.zbkj.service.dao.UserDao;
import com.zbkj.service.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.Range;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;

/**
 * 订单表 前端控制器
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
@Slf4j
@RestController
@RequestMapping("api/admin/doctor")
@Api(tags = "医生") //配合swagger使用
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    /**
     * 分页显示订单表
     *  @param request          搜索条件
     * @param pageParamRequest 分页参数
     */
    @ApiOperation(value = "分页列表") //配合swagger使用
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<Doctor>> getList(@Validated DoctorSearchRequest request, @Validated PageParamRequest pageParamRequest) {
        List<Doctor> adminList = doctorService.getAdminList(request, pageParamRequest);
        return CommonResult.success(CommonPage.restPage(adminList));
    }

    /**
     * 获取医生信息详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        Doctor doctor = doctorService.selectEbDoctorById(id);
        return  AjaxResult.success(doctor);
    }

    /**
     * 新增医生信息
     */
    @PostMapping
    public AjaxResult add(@RequestBody Doctor ebDoctor){
         doctorService.insertEbDoctor(ebDoctor);
        return  AjaxResult.success();
    }

    /**
     * 修改医生信息
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Doctor ebDoctor)
    {
        doctorService.updateEbDoctor(ebDoctor);
        return  AjaxResult.success();
    }

    /**
     * 删除医生信息
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        doctorService.deleteEbDoctorByIds(ids);
        return  AjaxResult.success();
    }
//


}



